﻿using MediatR;
using System.ComponentModel;

namespace LogTestApp.Commands
{
    public class TrsanctionPipelineBehavior<TResult, TResponse> : IPipelineBehavior<TResult, TResponse> where TResult : notnull
    {
        public async Task<TResponse> Handle(TResult request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
        {
            Console.WriteLine("事务已开启");

            var response = await next();

            Console.WriteLine("事务已提交");

            return response;
        }
    }

}